package com.cskaoyan.controller.mallController;

import com.cskaoyan.module.bean.BaseRespVo;
import com.cskaoyan.module.bean.param.BaseParam;
import com.cskaoyan.module.pojo.MarketBrand;
import com.cskaoyan.module.regionvo.BrandListVo;
import com.cskaoyan.service.BrandService;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.boot.json.JsonParseException;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;


@RestController
@RequestMapping("admin")
public class BrandController {

    @Autowired
    BrandService brandService;


    @RequestMapping("brand/list")
    public BaseRespVo brandList(Integer page, Integer limit, Integer id, String name, String sort, String order) {
        BaseRespVo result = brandService.brandList(page,limit,id ,name,sort,order);
        return result;
    }


    @PostMapping("brand/create")
    public BaseRespVo createBrand(@RequestBody MarketBrand marketBrand) {
        BaseRespVo baseRespVo = brandService.create(marketBrand);
        return baseRespVo;
    }

    @PostMapping("brand/update")
    public BaseRespVo updateBrand(@RequestBody MarketBrand marketBrand) {
        BaseRespVo baseRespVo = brandService.updateBrand(marketBrand);
        return baseRespVo;
    }

    @PostMapping("brand/delete")
    public BaseRespVo deleteBrand(@RequestBody MarketBrand marketBrand) {
        BaseRespVo baseRespVo = brandService.deleteBrand(marketBrand);
        return baseRespVo;
    }
}
